home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / version / frmvers.frm next >
Text File  |  1995-06-12  |  3KB  |  86 lines

  1. VERSION 2.00
  2. Begin Form frmVers 
  3.    Caption         =   "DOS and Windows Version Information"
  4.    ClientHeight    =   3420
  5.    ClientLeft      =   2730
  6.    ClientTop       =   1485
  7.    ClientWidth     =   5730
  8.    Height          =   3825
  9.    Left            =   2670
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3420
  12.    ScaleWidth      =   5730
  13.    Top             =   1140
  14.    Width           =   5850
  15.    Begin Label lblDosVer 
  16.       ForeColor       =   &H00FF0000&
  17.       Height          =   195
  18.       Left            =   2850
  19.       TabIndex        =   3
  20.       Top             =   825
  21.       Width           =   885
  22.    End
  23.    Begin Label Windows 
  24.       AutoSize        =   -1  'True
  25.       Caption         =   "Your Windows Version is:"
  26.       Height          =   195
  27.       Left            =   600
  28.       TabIndex        =   2
  29.       Top             =   1800
  30.       Width           =   2175
  31.    End
  32.    Begin Label MSDOS 
  33.       Caption         =   "Your MS-DOS Version is:"
  34.       Height          =   195
  35.       Left            =   630
  36.       TabIndex        =   1
  37.       Top             =   825
  38.       Width           =   2130
  39.    End
  40.    Begin Label lblWinVer 
  41.       ForeColor       =   &H00FF0000&
  42.       Height          =   210
  43.       Left            =   2865
  44.       TabIndex        =   0
  45.       Top             =   1800
  46.       Width           =   870
  47.    End
  48. End
  49. 'This API declaration retrieves Windows Version Information
  50. Declare Function GetFileVersionInfo% Lib "VER.DLL" (ByVal lpszFileName$, ByVal handle As Any, ByVal cbBuf&, ByVal lpvData$)
  51. 'This API declaration retrieves DOS Version Information
  52. Declare Function GetVersion Lib "Kernel" () As Long
  53.  
  54. 'NOTE: You can also use the "GetVersion" API to retrieve
  55. 'Windows version information, but it is only partially
  56. 'accurate. For example, if you are running Windows v3.11
  57. 'it will still return v3.1 or if you are running Windows 95
  58. 'it will return v3.95 instead of 4.00
  59.  
  60.  
  61.  
  62.  
  63.  
  64. Sub Form_Load ()
  65.  
  66.     'Show Windows Version
  67.     Dim Pos As Integer
  68.     Dim Version As String
  69.     Dim Ans As String
  70.     Version = Space$(255)
  71.     ret% = GetFileVersionInfo("user.exe", 0&, 254, Version)
  72.     Pos = InStr(1, Version, "FileVersion")
  73.     Ans = Mid$(Version, Pos + 12, 4)
  74.     lblWinVer.Caption = Ans
  75.  
  76.     'Shows DOS Version
  77.     J& = GetVersion()
  78.     DOS& = (J& And &HFFFF0000) / 65536
  79.     Lowbyte$ = Str$(DOS& And &HFF)
  80.     Highbyte$ = LTrim$(Str$((DOS& And &HFF00) / 256))
  81.     lblDosVer.Caption = Highbyte$ + "." + Lowbyte$
  82.  
  83.  
  84. End Sub
  85.  
  86.